﻿Imports System
Imports System.Collections.ObjectModel
Imports System.ComponentModel
Imports System.ComponentModel.Design
Imports System.Drawing
Imports System.Workflow.ComponentModel.Compiler
Imports System.Workflow.ComponentModel.Design

Namespace System.Workflow.Activities
    <ActivityValidator(GetType(EventDrivenValidator)), Designer(GetType(EventDrivenDesigner), GetType(IDesigner)), SRCategory("Standard"), ToolboxItem(GetType(ActivityToolboxItem)), ToolboxBitmap(GetType(EventDrivenActivity), "Resources.EventDriven.png"), SRDescription("EventDrivenActivityDescription")> _
    Public NotInheritable Class EventDrivenActivity
        Inherits SequenceActivity
        ' Methods
        Public Sub New()
        End Sub

        Public Sub New(ByVal name As String)
            MyBase.New(name)
        End Sub


        ' Properties
        <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(False)> _
        Public ReadOnly Property EventActivity As IEventActivity
            Get
                Dim enabledActivities As ReadOnlyCollection([Of] Activity) = MyBase.EnabledActivities
                If (enabledActivities.Count = 0) Then
                    Return Nothing
                End If
                Return [TryCast](enabledActivities.Item(0),IEventActivity)
            End Get
        End Property

    End Class
End Namespace

